package com.sprouting.personal.model.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.sprouting.personal.annotations.CheckLength;
import com.sprouting.personal.annotations.CheckNotNull;
import com.sprouting.personal.model.common.BaseModel;
import com.sprouting.personal.model.common.jsr.AddGroup;
import com.sprouting.personal.model.common.jsr.UpdGroup;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.util.Date;

/**
 * 事件
 *
 * @author ：LX（长沙麓谷）
 * @date 创建时间： 2022/11/16 15:41
 */
@Data
@TableName("ps_event")
public class PsEvent extends BaseModel {

    /**
     * 主键
     */
    @TableId
    @CheckNotNull(message = "非法ID", groups = UpdGroup.class)
    @Null(message = "无效ID", groups = AddGroup.class)
    private String id;
    /**
     * 所属用户ID
     */
    private String userId;
    /**
     * 事件发生时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
    @NotNull(message = "事件发生时间不能为空")
    private Date eventTime;
    /**
     * 事件内容
     */
    @CheckLength(min = 1, max = 2000, message = "事件内容超过长度限制")
    @CheckNotNull(message = "请输入事件内容")
    private String eventContent;
    /**
     * 事件级别
     * @see com.sprouting.personal.interfaces.common.Constant.EventLevel
     */
    private Integer eventLevel;
    /**
     * 事件地点
     * @see com.sprouting.personal.interfaces.common.Constant.ConfigCode#EVENT_ADDRESS 默认的在配置中
     */
    private String address;

}
